import Mock from 'mockjs'
import {categoryList} from "./goodManager";

const subscribePerformance = {
  status:'success',
  data:{
    successSubscribe:'@integer(10,30)',
    totalSubscribe:'@integer(20,40)',
    relativeRatio:'@float(0, 0.99, 2, 2)',
    cancelSubscribe:'@integer(1,10)',
    morethan1Visitor:'@integer(1,10)',
    newVisitor:'@integer(1,10)',
    frequentVisitor:'@float(0, 0.99, 2, 2)',
    'detail|3-10':[
      {
        subscriber:'@cname()',
        subscribeNum:'@integer(1,10)',
        presentTotal:'@float(1000, 10000, 2, 2)',
        consumption:'@float(1000, 10000, 2, 2)'
      }
    ]
  }
}

const dirnksPerformance = {
  status:'success',
  data: function(){
    let array = [],randomNum = 0
    for(var i = 0; i < Mock.Random.integer(3, 20); i++){
      randomNum = Mock.Random.integer(0, 29)
      array.push(Mock.mock({
        SUBSCRIBER: '@cname',
        'subscribe_DEPARTMENT|1':['营销部','市场部','楼面部','演义部','工程部'],
        GOODSTYPE_ID:categoryList.data[randomNum].GOODSTYPE_ID,
        goodTypeName:categoryList.data[randomNum].NAME,
        saleTotal:'@float(1000, 10000, 2, 2)'
      }))
    }
    return array
  }
}

const orderPerformance = {
  status:'success',
  'data|50-100':[
    {
      NAME: '@cname',
      'DEPARTMENT|1':['营销部','市场部','楼面部','演义部','工程部'],
      orderNum:'@integer(1,10)',
      orderTotal:'@float(1000, 10000, 2, 2)'
    }
  ]
}

const dirnksRanking = {
  status:'success',
  'data|50-100':[
    {
      name: '@ctitle',
      number:'@integer(10,100)',
      total:'@float(10000, 100000, 2, 2)'
    }
  ]
}

const areaRanking = {
  status:'success',
  data:function(){
    let array = [],areaArray = ['大厅区','吧台区','包厢区']
    for(var i = 0; i < areaArray.length; i++){
      array.push(Mock.mock({
        AREA: areaArray[i],
        number:'@integer(10,100)',
        total:'@float(10000, 100000, 2, 2)'
      }))
    }
    return array
  }
}

const memberRanking = {
  status:'success',
  'data|50-100':[
    {
      NAME: '@cname',
      chargeTotal:'@float(10000, 100000, 2, 2)',
      purchaseTotal:'@float(10000, 100000, 2, 2)'
    }
  ]
}

const tableSalesRanking = {
  status:'success',
  'data|20-50':[
    {
      'NUMBER|1':['A1台','B1台','C1台','M1台','A2台','B2台','C2台','M2台','A3台','B3台','C3台','M3台','1号房'],
      'AREA|1':['大厅区','吧台区','包厢区'],
      'ROOM_PLATFORM_TYPE|1': ['散台','卡座','高卡','包厢'],
      total:'@float(10000, 100000, 2, 2)'
    }
  ]
}

const tableSubscribeRanking = {
  status:'success',
  'data|20-50':[
    {
      'NUMBER|1':['A1台','B1台','C1台','M1台','A2台','B2台','C2台','M2台','A3台','B3台','C3台','M3台','1号房'],
      'AREA|1':['大厅区','吧台区','包厢区'],
      'ROOM_PLATFORM_TYPE|1': ['散台','卡座','高卡','包厢'],
      number:'@integer(10,100)'
    }
  ]
}

export {subscribePerformance,dirnksPerformance,orderPerformance,dirnksRanking,areaRanking,memberRanking,tableSalesRanking,tableSubscribeRanking}
